<template>
  <div class="w-[100%] h-[100%]">
    <iframe :src="`${host}oms?type=push&path=user/blacklist`" width="100%" height="100%" :onload="onload" id="iframe-view" v-show="iframeShow"></iframe>
  </div>
</template>

<script setup name="name">
const host = ref("")
console.log(import.meta.env)
if (import.meta.env.MODE == "production") {
  host.value = "https://app.sz2k.com/"
} else if (import.meta.env.MODE == "development") {
  host.value = "http://localhost:3000/"
} else if (import.meta.env.MODE == "staging") {
  host.value = "http://10.20.9.33:10086/"
}
const iframeShow = ref(false)
onMounted(() => {
  iframeShow.value = false
})
const onload = () => {
  setTimeout(() => {
    console.log("DOM fully loaded and parsed")
    // 进行DOM操作相关代码
    let domDocum = document.getElementById("iframe-view").contentWindow.document
    console.log(domDocum.getElementsByClassName("main-container"))
    domDocum.getElementsByClassName("main-container")[0].style.height = "100vh"
    domDocum.getElementsByClassName("main-container")[0].style.width = "100vw"
    domDocum.getElementsByClassName("main-container")[0].style.marginLeft = "0"
    domDocum.getElementsByClassName("app-main")[0].style.height = "100vh"

    console.log(domDocum)
    domDocum.getElementsByClassName("app-header")[0].style.display = "none"
    domDocum.getElementsByClassName("navbar")[0].style.display = "none"
    domDocum.getElementsByClassName("sidebar-container")[0].style.display = "none"
    iframeShow.value = true
  }, 500)
}
</script>

<style></style>
